/*******************************************************************************
 * -------
 *   Copyright 2011 @ Fluid India Consultancy
 *   All Rights Reserved
 * -------
 ******************************************************************************/
package org.fluidindia.core;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.kapil.framework.database.IDatabaseSetup;

/**
 * <p>
 * Base class for all other test cases in the application. This class provides the following functionalities:
 * <ol>
 * <li>Loads Spring's base context</li>
 * <li>Loads all the data in to the Database</li>
 * <li>Method to loads beans from Spring Context</li>
 * </ol>
 * </p>
 */
public abstract class BaseTestCase
{
    protected static final ClassPathXmlApplicationContext context;

    static
    {
        context = new ClassPathXmlApplicationContext("root-test-context.xml");
        context.registerShutdownHook();
    }
    
    
    protected Object getBean(String name)
    {
        return context.getBean(name);
    }
    
    
    protected IDatabaseSetup getDatabaseSetupBean()
    {
       return (IDatabaseSetup) this.getBean("databaseSetup");
    }
}
